/* file: zm.h */
#ifndef ZM_H
#define ZM_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

extern FILE *asm_point;
extern char buffer[100];

typedef enum
{
    DATA_FLAG,
    REG_FLAG,
    MEM_FLAG
}FLAG;

typedef struct
{
    FLAG flag;
    int data;
}OP_DATA;

typedef enum
{
    MOV, PUSH, POP, XCHG, ADD, SUB, MUL, DIV, JNE, JLS, JLE, JGT, JGE, JEQ, JMP, OUT, IN
}OP_CODE;

typedef struct
{
    OP_CODE op_code;
    OP_DATA data1;
    OP_DATA data2;
}code_seg;

#define AX 0
#define DX 1

extern code_seg code_mem[1024];
extern int data_mem[1024];
extern int reg[2];
extern int stack_mem[128];
extern int top;

static struct
{
    char *str;
    OP_CODE mycode;
}find_table[] = {

{"mov", MOV}, {"push", PUSH}, {"pop", POP}, {"xchg", XCHG}, 
{"add", ADD}, {"sub", SUB}, {"mul", MUL}, {"div", DIV},{"jls",JLS}, 
{"jne", JNE}, {"jle", JLE}, {"jgt", JGT}, {"jge", JGE}, {"jeq", JEQ}, {"jmp", JMP}, 
{"out", OUT}, {"in", IN}

};

#endif